<template>
  <div>
    <el-table
          :data="page.records"
          style="width: 90%;margin-left: 40px;margin-top: 100px;">
          <el-table-column
            prop="nickName"
            label="用户昵称"
            width="100">
          </el-table-column>
          <el-table-column
            prop="changeScore"
            label="最新变动积分"
            width="120">
          </el-table-column>
          <el-table-column
            prop="changeDetails"
            label="最新变动详情"
            width="180">
          </el-table-column>
          <el-table-column
            prop="changeTime"
            label="积分变动时间"
            width="180">
          </el-table-column>
          <el-table-column
            prop="scoreTotal"
            label="积分总额"
            width="100">
          </el-table-column>
          <el-table-column label="历史详情">
          <template v-slot="scope">
           <el-button type="text" @click="findUserScore(scope.row.list)">查看历史详情</el-button>
           </template>
          </el-table-column>
        </el-table>
       <div class="block" style="margin-left: 50px;">
           <el-pagination
             @size-change="handleSizeChange"
             @current-change="handleCurrentChange"
             :page-sizes="[5, 10, 20]"
             :page-size="5"
             layout="total, sizes, prev, pager, next, jumper"
             :total="page.total">
           </el-pagination>
         </div>

        <el-dialog
          title="用户历史积分"
          :visible.sync="dialogVisible1"
          width="50%"
          >
          <el-table
                :data="scoreList"
                style="width: 100%">
                <el-table-column
                  prop="changeScore"
                  label="最新变动积分"
                  width="120">
                </el-table-column>
                <el-table-column
                  prop="changeDetails"
                  label="最新变动详情"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="changeTime"
                  label="积分变动时间"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="scoreTotal"
                  label="积分余额"
                  width="100">
                </el-table-column>
              </el-table>
        </el-dialog>
  </div>
</template>

<script>
  export default{
    name:"FindScore",
    data(){
      return{
      page:{},
      pageNum:1,
      pageSize:5,
      scoreList:[],
      dialogVisible1:false
      }
    },
    methods:{
      handleSizeChange(val) {
       this.pageSize=val
       this.pageAllUserScore()
      },
      handleCurrentChange(val) {
       this.pageNum=val
       this.pageAllUserScore()
      },
     findUserScore(list){
       this.scoreList=list
       this.dialogVisible1=true
     },
    pageAllUserScore(){
      this.$http.get("/user/userScore/pageAllUserScore",{
        params:{
          pageNum:this.pageNum,
          pageSize:this.pageSize
        }
      }).then(resp=>{
        this.page=resp.data.data
      })
    }
    },
    created(){
      this.pageAllUserScore()
    }
  }
</script>

<style>
</style>
